<template>
  <div class="recruitForm-box">
    <div class="search-box">
      <el-button type="primary" @click="goNewForm">新建表单</el-button>
      <div class="search-item">
        <el-select v-model="keyStatus" placeholder="全部状态">
          <el-option
            v-for="item in keyStatusOptions"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          />
        </el-select>
        <el-input v-model="keyArticleName" placeholder="请输入班级名称" style="width:200px;" />
        <el-button type="primary">搜索</el-button>
      </div>
    </div>
    <el-table :data="formTableData" border style="width: 100%;">
      <el-table-column prop="formName" label="表单名称" align="center" width="300" />
      <el-table-column prop="fillNum" label="填写人数" align="center" />
      <el-table-column prop="status" label="状态" align="center" />
      <el-table-column label="操作" align="center">
        <template slot-scope="scope">
          <el-button type="text" @click="goNewForm">编辑</el-button>
          <el-button type="text" @click="finishBtn">结束</el-button>
          <el-button type="text">导出</el-button>
          <el-button type="text" @click="removeBtn">删除</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
export default {
  data() {
    return {
      keyStatus: '',
      keyArticleName: '',
      keyStatusOptions: [
        {
          value: '未发布',
          label: '未发布'
        },
        {
          value: '已发布',
          label: '已发布'
        },
        {
          value: '已结束',
          label: '已结束'
        }
      ],
      formTableData: [
        {
          id: '1',
          url: '/src/assets/subjectImg.png',
          formName: '语文作文提升',
          fillNum: '23',
          status: '已发布',
        }
      ],
    }
  },
  methods: {
    showClassStudent(id) {
      this.classStudentDialog = true
      // 请求对应班级学员数据
    },
    handleCurrentChange(val) {
      this.currentPage = val
    },
    goNewForm(id) {
      this.$router.push({ name: 'Compileform' })
    },
    finishBtn() {
      this.$confirm('确认要结束该课程吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // 下架
      })
    },
    removeBtn() {
      this.$confirm('确认要删除该课程吗？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        // 删除
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.recruitForm-box {
  .search-box {
    margin-bottom: 20px;
    .search-item {
      float: right;
    }
  }
}
</style>
